using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BlueFinity.mvNET.CoreObjects;


namespace mvLibrary
{
    public partial class HelpForm : Form
    {
        public mvAccount _pickAccount;
        private string _user;
        private string _helpText;
        private string _formName;
        public mvAccount PickAccount
        {
            get { return _pickAccount; }
            set { _pickAccount = value; }
        }
        public string User
        {
            get { return _user; }
            set { _user = value; }
        }
        public string HelpText
        {
            get { return _helpText; }
            set { _helpText = value; }
        }
        public string FormName
        {
            get { return _formName; }
            set { _formName = value; }
        }
        public HelpForm()
        {
            InitializeComponent();
        }

        private void HelpFor_Load(object sender, EventArgs e)
        {
            textHelpForm.Text = _helpText;
            string userNotes = string.Empty;
            string showHelpMode = "R";
            try
            {
               _pickAccount.Login();
               _pickAccount.CallProg("SHOW.HELP", ref _formName, ref _user,  ref userNotes,ref showHelpMode);
               textUserNotes.Text = userNotes;
            }
            catch
            {
                textUserNotes.Text = "";
            }
            finally
            {
                _pickAccount.Logout();
            }
            labelFormName.Text = "Formulario " + _formName;
            textUserNotes.Focus();
        }

        private void butSave_Click(object sender, EventArgs e)
        {
            try
            {
                string userNotes = textUserNotes.Text;
                string showHelpMode = "W";
                _pickAccount.Login();
                _pickAccount.CallProg("SHOW.HELP", ref _formName, ref _user, ref userNotes, ref showHelpMode);
            }
            catch (mvException mvEx)
            {
                MessageBox.Show("Error al grabar. \n\nMensaje del servidor: " + mvEx.Message);
            }
            finally
            {
                _pickAccount.Logout();
            }
        }

       

        

        
    }
}

